package com.ruoyi.pos.domain.dto.transaction.response;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * 销售小票响应DTO
 * 
 * @author ruoyi
 * @date 2025-01-30
 */
@Data
@ApiModel(description = "销售小票响应")
public class SaleTicketResponse {

    @ApiModelProperty(value = "销售ID")
    private Long transactionId;

    @ApiModelProperty(value = "销售流水号")
    private String transactionNo;

    @ApiModelProperty(value = "本地销售号")
    private String localTransactionNo;

    @ApiModelProperty(value = "设备ID")
    private Long deviceId;

    @ApiModelProperty(value = "设备名称")
    private String deviceName;

    @ApiModelProperty(value = "柜组ID")
    private Long groupId;

    @ApiModelProperty(value = "柜组名称")
    private String groupName;

    @ApiModelProperty(value = "柜组编码")
    private String groupCode;

    @ApiModelProperty(value = "收银员ID")
    private Long cashierId;

    @ApiModelProperty(value = "收银员姓名")
    private String cashierName;

    @ApiModelProperty(value = "会员ID")
    private Long memberId;

    @ApiModelProperty(value = "会员姓名")
    private String memberName;

    @ApiModelProperty(value = "单据类型")
    private String documentType;

    @ApiModelProperty(value = "单据类型名称")
    private String documentTypeName;

    @ApiModelProperty(value = "商品总数量")
    private Integer totalQuantity;

    @ApiModelProperty(value = "商品总金额")
    private BigDecimal totalAmount;

    @ApiModelProperty(value = "折扣金额")
    private BigDecimal discountAmount;

    @ApiModelProperty(value = "实付金额")
    private BigDecimal payAmount;

    @ApiModelProperty(value = "找零金额")
    private BigDecimal changeAmount;

    @ApiModelProperty(value = "交易状态")
    private String transactionStatus;

    @ApiModelProperty(value = "交易状态名称")
    private String transactionStatusName;

    @ApiModelProperty(value = "交易时间")
    private Date transactionTime;

    @ApiModelProperty(value = "备注")
    private String remark;

    @ApiModelProperty(value = "销售明细列表")
    private List<SaleDetailResponse> saleDetails;

    @ApiModelProperty(value = "支付信息列表")
    private List<SalePayResponse> salePays;
    
    @ApiModelProperty(value = "操作是否成功")
    private Boolean success;
    
    @ApiModelProperty(value = "返回消息")
    private String message;

    /**
     * 销售明细响应DTO
     */
    @Data
    @ApiModel(description = "销售明细响应")
    public static class SaleDetailResponse {

        @ApiModelProperty(value = "明细ID")
        private Long detailId;

        @ApiModelProperty(value = "商品ID")
        private Long goodsId;

        @ApiModelProperty(value = "商品编码")
        private String goodsCode;

        @ApiModelProperty(value = "商品名称")
        private String goodsName;

        @ApiModelProperty(value = "销售数量")
        private Integer quantity;

        @ApiModelProperty(value = "销售单价")
        private BigDecimal unitPrice;

        @ApiModelProperty(value = "销售金额")
        private BigDecimal amount;

        @ApiModelProperty(value = "折扣率")
        private BigDecimal discountRate;

        @ApiModelProperty(value = "折扣金额")
        private BigDecimal discountAmount;

        @ApiModelProperty(value = "是否赠品")
        private String isGift;
    }

    /**
     * 销售支付响应DTO
     */
    @Data
    @ApiModel(description = "销售支付响应")
    public static class SalePayResponse {

        @ApiModelProperty(value = "支付ID")
        private Long payId;

        @ApiModelProperty(value = "支付方式ID")
        private Long paymentTypeId;

        @ApiModelProperty(value = "支付方式编码")
        private String paymentTypeCode;

        @ApiModelProperty(value = "支付方式名称")
        private String paymentTypeName;

        @ApiModelProperty(value = "支付金额")
        private BigDecimal paymentAmount;

        @ApiModelProperty(value = "支付流水号")
        private String paymentNo;

        @ApiModelProperty(value = "支付状态")
        private String paymentStatus;

        @ApiModelProperty(value = "支付状态名称")
        private String paymentStatusName;

        @ApiModelProperty(value = "支付时间")
        private Date paymentTime;

        @ApiModelProperty(value = "支付备注")
        private String paymentRemark;
    }
}